﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;

namespace CapstoneMockup.Data
{
    public class DataMethods
    {
        public static bool PasswordChecker(string password1, string password2)
        {
            if (password1.Length != password2.Length)
                return false;
            for (int i = 0; i < password1.Length; i++)
                if (password1[i] != password2[i])
                    return false;

            return true;
        }

        public static ObservableCollection<WeeklyTimeStamps> WeeksOfStamps(ObservableCollection<Timestamps> listOfHours)
        {
            var weeklyTimeStamps = new ObservableCollection<WeeklyTimeStamps>();
            for (int i = 0; i < 52; i++)
            {
                var weekListOfTimeStamps =
                    listOfHours.Where(ts => (ts.StartTime.DayOfYear / 7) == i && (ts.EndTime.DayOfYear / 7) == i && ts.StartTime.Year == ts.EndTime.Year).ToObservableCollection();

                if (weekListOfTimeStamps.Count > 0)
                    weeklyTimeStamps.Add(new WeeklyTimeStamps(weekListOfTimeStamps));
            }
            return weeklyTimeStamps;
        } 
    }
}
